package com.zsw.exception;

import lombok.ToString;

/**
 * @author zhangsw
 */
@ToString
public class ResponseDTO<T> extends ResponseBaseDTO {
    public static ResponseBaseDTO success() {
        return success(null);
    }

    public static ResponseBaseDTO success(Object data) {
        return ResponseBaseDTO.builder().code(UserErrorEnum.SUCCESS.getCode()).message(UserErrorEnum.SUCCESS.getMsg()).data(data).build();
    }

    public static ResponseBaseDTO error(String code, String message) {
        return ResponseBaseDTO.builder().code(code).message(message).build();
    }

    public static ResponseBaseDTO error(UserErrorEnum errorEnum) {
        return ResponseBaseDTO.builder().code(errorEnum.getCode()).message(errorEnum.getMsg()).build();
    }

    public static ResponseBaseDTO error(UserErrorEnum errorEnum, String message) {
        return ResponseBaseDTO.builder().code(errorEnum.getCode()).message(message).build();
    }
}